package wang.chunfan.springcoud.learning.api.gateway.config;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @version 1.0
 * @Author wangchunfan
 * @Date 2020/5/26 15:40
 * 使用 java bean 的配置方式
 **/
@Configuration
public class GatewayConfig {
    @Bean
    public RouteLocator customerRouteLocator(RouteLocatorBuilder builder) {
        return builder.routes()
                .route("path_route2", r -> r.path("/user/list")
                        .uri("http://localhost:8200/user/list"))
                .build();
    }
}
